<template>
  <div>
    <!--顶部导航-->
    <div class="top">
      <span class="iconfont iconnew"></span>
      <div class="search">
        <span class="iconfont iconsearch"></span>
        <span>搜索新闻</span>
      </div>
      <span class="iconfont iconwode"></span>
    </div>
    <!--顶部Tab标签页-->
    <van-tabs v-model="active">
      <van-tab :title="item.name" v-for="item in tabname" :key="item.id"
        >{{ item.name }}的内容信息</van-tab
      >
    </van-tabs>
  </div>
</template>

<script>
export default {
  methods: {},
  data() {
    return {
      active: "0",
      tabname: [],
    };
  },
  created() {
    this.$axios({
      url: "/category",
    }).then((res) => {
      this.tabname = res.data.data;
      console.log(this.tabname);
    });
  },
};
</script>

<style lang="less" scoped>
// 顶部导航样式
.top {
  height: 49 / 360 * 100vw;
  background-color: #ff0000;
  display: flex;
  align-items: center;
  color: white;
  padding: 0 12 / 360 * 100vw;
  .iconnew {
    font-size: 54 / 360 * 100vw;
  }
  .search {
    background-color: rgba(255, 255, 255, 0.3);
    margin: 0 10 / 360 * 100vw;
    height: 34 / 360 * 100vw;
    line-height: 34 / 360 * 100vw;
    border-radius: 17 / 360 * 100vw;
    flex: 1;
    text-align: center;
    .iconsearch {
      margin-right: 6 / 360 * 100vw;
    }
  }
  .iconwode {
    font-size: 24 / 360 * 100vw;
    opacity: 0.8;
  }
}
</style>